import time

def timer(f):
    def inner(*args,**kwargs):
        time1 = time.time()
        res = f()
        time2 = time.time()
        print("程序运行时间为：%f"%(time2 - time1))
    return inner

@timer
def func():
    print("lifeibiao is a good man")
    time.sleep(2)
    print("lifeibiao is a good man")

func()